#!/bin/sh
#
# Distributed under the terms of GNU GPL version 2
#
# http://marius.scurtescu.com/?p=102
# http://gnomefiles.org/app.php?soft_id=1059

LOGFILE=`mktemp -t svn_rename.XXXXXX`
ICONPATH="`dirname $0`/svn.xpm"

if [ $# -ne 1 ] ; then
    zenity --warning  --title="Subversion: Rename" --warning-text="Please select a single file or directory and try again ..." --width=600 --height=400 --window-icon="$ICONPATH"
	exit -1
fi 

NEWNAME=`zenity --entry --title="Subversion: Rename" --text="Enter a new name for '$1':" --entry-text="$1" --width=400 --window-icon="$ICONPATH" 2>&1`

if [ $? -eq 0 ] ; then
    svn mv $1 $NEWNAME &> $LOGFILE
    zenity --text-info --title="Subversion: Rename" --filename=$LOGFILE --width=600 --height=400 --window-icon="$ICONPATH"
    rm -f $LOGFILE
fi
